#include <iostream>
#include <algorithm>
#include <map>

using namespace std;

typedef struct 
{
    int left;
    int right;
} Node;

string max(string left, string right)
{
    int i;
    if (left.size() > right.size())
    {
        return left;
    }
    if (right.size() > left.size())
    {
        return right;
    }
    if (left == right)
    {
        return left;
    }
    
    for (i = 0; i < left.size(); i++)
    {
        if (left[i] > right[i])
        {
            return left;
        }
        if (right[i] > left[i])
        {
            return right;
        }
    }

    cout << "\n>>>> error\n";
    return "error";
}

string add(string a, string b)
{
    string ret, temp;
    int t, i;
    if (b.size() > a.size())
    {
        temp = a;
        a = b;
        b = temp;
    }
    
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());

    t = 0;
    for (i = 0; i < a.size(); i++)
    {
        t += a[i] - '0';
        if (i < b.size())
        {
            t += b[i] - '0';
        }
        ret.push_back(t % 10 + '0');
        t /= 10;        
    }

    if (t > 0)
    {
        ret.push_back(t + '0');
    }
    reverse(ret.begin(), ret.end());
    return ret;
}

string adv(string a, int b)
{
    string ret, temp;
    int i, j, t, bt;

    reverse(a.begin(), a.end());

    ret = "";
    for (i = 0; i < a.size(); i++)
    {
        t = 0;
        temp = "";
        bt = b;
        while (bt)
        {
            t += (a[i] - '0') * (bt % 10);
            bt /= 10;
            temp.push_back(t % 10 + '0');
            t /= 10;
        }
        if (t > 0)
        {
            temp.push_back(t + '0');
        }
        reverse(temp.begin(), temp.end());
        for (j = 0; j < i; j++)
        {
            temp.push_back('0');
        }
        ret = add(ret, temp);
    }

    for (i = 0; i < ret.size() && ret[i] == '0'; i++);
    ret = ret.substr(i, ret.size() - i);
    
    if (ret == "")
    {
        ret = "0";
    }
    
    return ret;
}

string div(string a, int b)
{
    string ret;
    int t = 0;
    int i;
    for (i = 0; i < a.size(); i++)
    {
        t *= 10;
        t += a[i] - '0';
        ret.push_back(t / b + '0');
        t %= b;
    }
    for (i = 0; i < ret.size() && ret[i] == '0'; i++);
    ret = ret.substr(i, ret.size() - i);
    return ret;
}

int main(int argc, char const *argv[])
{
    multimap<int, Node> temps;
    Node temp;
    int n, kr, i, t;
    string kl, nmax;
    cin >> n >> kl >> kr;

    for (i = 0; i < n; i++)
    {
        cin >> temp.left;
        cin >> temp.right;
        t = temp.left * temp.right;
        temps.insert(make_pair(t, temp));
    }

    nmax = "0";
    for (i = 0; i < n; i++)
    {
        cout << i << "\n";
        temp = (*temps.begin()).second;
        nmax = max(nmax, div(kl, temp.right));
        // cout << "-" << kl << "- ";
        kl = adv(kl, temp.left);
        temps.erase(temps.begin());
    }
    
    cout << nmax;

    return 0;
}
